using System.IO.Compression;
using System.Diagnostics.Contracts;
using System.Security.Cryptography.X509Certificates;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class MainControl : MonoBehaviour
{
    public ToggleGroup topToggleGroup;
    public GameObject meshCreatePanel;
    public GameObject pretreatmentPanel;
    public GameObject calculatePanel;
    
    public Toggle[] toggles;
    // Start is called before the first frame update
    void Start()
    {
        for (int i = 0; i < toggles.Length; i++)
        {
            Toggle toggle = toggles[i];
            toggle.onValueChanged.AddListener((bool value)=>OnValueChange(toggle));
        }
        toggles[0].Select();
        
    }

    // Update is called once per frame
    void OnValueChange(Toggle t)
    {
        Debug.Log("OnValueChange" + t.name + " " + t.isOn);
        if(t.isOn)
        {
            ShowPanel(t.name);
            // switch (t.name)
            // {
            //     case "Toggle_0":
                
            //     break;
            //     case "Toggle_1":
            //     break;
            //     case "Toggle_2":
            //     break;
            //     default:
            // }
        }
    }

    void ShowPanel(string panelName)
    {
        meshCreatePanel.SetActive(panelName == "Toggle_0");
        pretreatmentPanel.SetActive(panelName == "Toggle_1");
        calculatePanel.SetActive(panelName == "Toggle_2");
    }
}
